﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Brjnk.GpxExplorer.UI.Controls">

    <PathGeometry x:Key="LeftButtonPath">
        <PathFigure StartPoint="1,0">
            <LineSegment Point="1,1" />
            <LineSegment Point="0.25,1" />
            <BezierSegment Point1="0,0.8" Point2="0,0.2" Point3="0.25,0" />
            <LineSegment Point="1,0" />
        </PathFigure>
    </PathGeometry>
    <PathGeometry x:Key="RightButtonPath">
        <PathFigure StartPoint="0,0">
            <LineSegment Point="0,1" />
            <LineSegment Point="0.75,1" />
            <BezierSegment Point1="1,0.8" Point2="1,0.2" Point3="0.75,0" />
            <LineSegment Point="0,0" />
        </PathFigure>
    </PathGeometry>

    <LinearGradientBrush StartPoint="0,0.5"  EndPoint="1,0.5" x:Key="BackgroundLeft">
        <GradientStop Offset="0" Color="LightBlue" />
        <GradientStop Offset="1" Color="#7090FF" />
    </LinearGradientBrush>

    <LinearGradientBrush StartPoint="0,0.5"  EndPoint="1,0.5" x:Key="BackgroundRight">
        <GradientStop Offset="0" Color="Blue" />
        <GradientStop Offset="1" Color="DarkBlue" />
    </LinearGradientBrush>

    <Style TargetType="{x:Type local:ZoomControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ZoomControl}">
                    <UniformGrid Columns="2">
                        <RepeatButton Content="-" Background="{StaticResource BackgroundLeft}" Command="{TemplateBinding DecreaseCommand}">
                            <RepeatButton.Template>
                                <ControlTemplate TargetType="RepeatButton">
                                    <Border TextBlock.Foreground="White">

                                        <Border.Background>
                                            <DrawingBrush>
                                                <DrawingBrush.Drawing>
                                                    <GeometryDrawing Brush="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Background}">
                                                        <GeometryDrawing.Geometry>
                                                            <StaticResourceExtension ResourceKey="LeftButtonPath" />
                                                        </GeometryDrawing.Geometry>
                                                    </GeometryDrawing>
                                                </DrawingBrush.Drawing>
                                            </DrawingBrush>
                                        </Border.Background>
                                        <Viewbox>
                                            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{TemplateBinding Content}" />
                                        </Viewbox>
                                    </Border>
                                </ControlTemplate>
                            </RepeatButton.Template>
                        </RepeatButton>
                        <RepeatButton Content="+" Background="{StaticResource BackgroundRight}" BorderBrush="Red" BorderThickness="2"  Command="{TemplateBinding IncreaseCommand}">
                            <RepeatButton.Template>
                                <ControlTemplate TargetType="RepeatButton">
                                    <Border TextBlock.Foreground="White">
                                        <Border.Background>
                                            <DrawingBrush>
                                                <DrawingBrush.Drawing>
                                                    <GeometryDrawing Brush="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Background}">
                                                        <GeometryDrawing.Geometry>
                                                            <StaticResourceExtension ResourceKey="RightButtonPath" />
                                                        </GeometryDrawing.Geometry>
                                                    </GeometryDrawing>
                                                </DrawingBrush.Drawing>
                                            </DrawingBrush>
                                        </Border.Background>
                                        <Viewbox>
                                            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{TemplateBinding Content}" />
                                        </Viewbox>
                                    </Border>
                                </ControlTemplate>
                            </RepeatButton.Template>
                        </RepeatButton>
                    </UniformGrid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>